package common;

import java.util.ArrayList;

import math.LeastAbsMethodIterLS;
import math.Vector2D;
import math.AbstractEstimateIterMin;
import math.LeastSquareMethod;
import math.probability.NormalDistribution;

public class TestNumerical {
	
	public void doTestLAM () {
		int N = 50;
		ArrayList<Double> U = new ArrayList<Double>(); 
		ArrayList<Double> V = new ArrayList<Double>();
		NormalDistribution eps = new NormalDistribution(0.0,1.0);
		System.out.println("U V");
		for (int i=0; i<N; i++) {
			U.add(i+1.0);
			V.add(i+1.0+5.0 + eps.getNext());
			System.out.println(U.get(i) + " " + V.get(i));
		}
		AbstractEstimateIterMin lam = new LeastAbsMethodIterLS();
		LeastSquareMethod lsm = new LeastSquareMethod();
		
		System.out.println("Results");
		System.out.println("LSM");
		System.out.println(lsm.estimateFull(V, U).getV1());
		System.out.println(lsm.estimateFull(V, U).getV2());
		System.out.println("LAM");
		System.out.println(lam.estimateFull(V, U).getV1());
		System.out.println(lam.estimateFull(V, U).getV2());
	
	}
	
	public static void main (String[] arg) {
		TestNumerical t = new TestNumerical();
		t.doTestLAM();
	}
	
}
